CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(ParallelMLP)

SET(CMAKE_CXX_FLAGS "-O2 -std=c++0x")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)

FIND_PACKAGE(FLEX REQUIRED)
FIND_PACKAGE(BISON REQUIRED)
FIND_PACKAGE(CUDA)
FIND_PACKAGE(MPI)

ADD_SUBDIRECTORY(src)

LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/arff)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/exception)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/mlp)

ADD_EXECUTABLE(pmlp_serial src/SerialMain.cpp)
TARGET_LINK_LIBRARIES(pmlp_serial arff exception mlp_serial)

IF(CUDA_FOUND)
    INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS})
    ADD_EXECUTABLE(pmlp_cuda src/CUDAMain.cpp)
    TARGET_LINK_LIBRARIES(pmlp_cuda arff exception mlp_cuda)
ENDIF(CUDA_FOUND)

IF(MPI_FOUND)
    INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH})
    ADD_EXECUTABLE(pmlp_mpi src/MPIMain.cpp)
    TARGET_LINK_LIBRARIES(pmlp_mpi arff exception mlp_mpi)
ENDIF(MPI_FOUND)
